package fyp.spedmew.connector;

import android.os.AsyncTask;
import android.util.Log;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import fyp.spedmew.backend.entity.checkInEndpoint.model.CheckIn;

public class CheckInFindByJobIdATask extends AsyncTask<String, Void, List<CheckIn>> {
    private static final String TAG = new Object(){}.getClass().getCanonicalName();

    @Override
    protected List<CheckIn> doInBackground(String... params) {
        List<CheckIn> result;
        try {
            result = ApiService.getCheckInEndpoint().findCheckInByJobId(Long.valueOf(params[0])).execute().getItems();
        } catch (IOException e) {
            Log.e(TAG, Log.getStackTraceString(e));
            result = Collections.emptyList();
        }
        return result;
    }
}
